package lxs.tool.liberator.work.controller;

import lxs.tool.liberator.common.base.result.Response;
import lxs.tool.liberator.work.pojo.Entity;
import lxs.tool.liberator.work.service.EntityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("work/entity")
public class EntityController {
    @Autowired
    private EntityService entityService;

    @GetMapping("showTable")
    public Response showTable() throws Exception {
        return entityService.showTable();
    }

    @GetMapping("getOptions")
    public Response getOptions() throws Exception {
        return entityService.getOptions();
    }

    @GetMapping("add")
    public Response add() {
        return entityService.add();
    }

    @GetMapping("deleteById")
    public Response deleteById(String id) {
        return entityService.deleteById(id);
    }

    @PostMapping("update")
    public Response update(@RequestBody Entity entity) {
        return entityService.update(entity);
    }
}
